//
//  MZY_AL_textCell.m
//  FullHouse
//
//  Created by dllo on 16/1/27.
//  Copyright © 2016年 yy. All rights reserved.
//

#import "MZY_AL_textCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation MZY_AL_textCell

- (void)dealloc
{
    [self.wordLabel release];
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    self.contentView.backgroundColor = [UIColor yellowColor];
    
    self.wordLabel = [[UILabel alloc]init];
    self.wordLabel.backgroundColor = [UIColor whiteColor];
    self.wordLabel.numberOfLines = 0;
    [self.wordLabel sizeToFit];
    [self.contentView addSubview:self.wordLabel];
    [self.wordLabel release];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:18],NSFontAttributeName, nil];
    CGRect rect = [self.wordLabel.text boundingRectWithSize:CGSizeMake(WIDTH - 20, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.wordLabel.frame = CGRectMake(10, 10, WIDTH - 20, rect.size.height - 20);
}

@end
